package datatypes.r2.basic.impl;

import datatypes.r2.basic.BIN;
import datatypes.r2.basic.CS;
import datatypes.r2.basic.ED;
import datatypes.r2.basic.ST;
import datatypes.r2.flavors.TEL_URL;
import datatypes.r2.foundation.DSET;
import datatypes.r2.foundation.impl.DataValue;
import datatypes.r2.foundation.impl.DiscreteSet;
import datatypes.r2.quantities.INT;
import datatypes.r2.quantities.impl.IntegerNumber;

/**
 * Data that is primarily intended for human interpretation or for further
 * machine processing outside the scope of HL7.
 * 
 * This includes unformatted or formatted written language, multimedia data, or
 * structured information as defined by a different standard (e.g.,
 * XML-signatures). Instead of the data, an ED may contain only a reference (see
 * TEL). Note that ST is a specialization of ED where the mediaType is fixed to
 * text/plain and several other properties are constrained to null.
 * 
 * @author Obama
 * 
 */
public class EncapsulatedData extends DataValue implements ED {

	private static final long serialVersionUID = 1L;

	private BinaryData data;
	private CodedSimpleValue mediaType;
	private CodedSimpleValue charset;
	private CodedSimpleValue language;
	private CodedSimpleValue compression;
	private TEL_URL reference;
	private BinaryData integrityCheck;
	private CodedSimpleValue integrityCheckAlgorithm;
	private CharacterString description;
	private EncapsulatedData thumbnail;
	private DiscreteSet<EncapsulatedData> translation;
	private IntegerNumber length;

	/**
	 * The binary content of the ED
	 */
	@Override
	public BIN data() {
		return data;
	}

	/**
	 * The type of the encapsulated data.
	 */
	@Override
	public CS mediaType() {

		return mediaType;
	}

	/**
	 * An Internet Assigned Numbers Authority (IANA) Charset Registered
	 * character set and character encoding for character-based media types.
	 */
	@Override
	public CS charset() {

		return charset;
	}

	/**
	 * The human language of the content.
	 */
	@Override
	public CS language() {

		return language;
	}

	/**
	 * The compression algorithm, if any, used on the raw byte data.
	 */
	@Override
	public CS compression() {

		return compression;
	}

	/**
	 * A URL the target of which is taken as the binary content of the ED.
	 */
	@Override
	public TEL_URL reference() {

		return reference;
	}

	/**
	 * A checksum calculated over the binary data.
	 */
	@Override
	public BIN integrityCheck() {

		return integrityCheck;
	}

	/**
	 * The algorithm used to compute the integrityCheck value.
	 */
	@Override
	public CS integrityCheckAlgorithm() {

		return integrityCheckAlgorithm;
	}

	/**
	 * An alternative description of the media where the context is not suitable
	 * for rendering the media.
	 */
	@Override
	public ST description() {

		return description;
	}

	/**
	 * An abbreviated rendition of the full data.
	 */
	@Override
	public ED thumbnail() {

		return thumbnail;
	}

	/**
	 * Alternate renditions of the same content translated into a different
	 * language or a different mediaType. The translation property is a set of
	 * ED that each translate the first rendition into a different language or
	 * use a different mediaType. Each element of the translation set SHALL be a
	 * translation of the ED value. Translations SHALL NOT contain translations.
	 */
	@Override
	public DSET<? extends ED> translation() {

		return translation;
	}

	/**
	 * The length of the content in the ED.
	 */
	@Override
	public INT length() {

		return length;
	}

	/**
	 * A contiguous sublist of the ED containing the content found from index
	 * start to end, inclusively.
	 */
	@Override
	public ED subPart(INT start, INT end) {
		// TODO Auto-generated method stub
		return null;
	}

}
